using System;
using System.Collections.Generic;
using System.Text;
using SP.Parameter;

namespace SP
{
    public abstract class AbstractReactor : IReactor
    {
        public AbstractReactor()
        {
        }

        public abstract string Name { get;}

        public abstract string[] CodeFiles { get;}

        public abstract void InitShader(Shader shader);

        public abstract void Generate(Shader shader, string codeFile, StringBuilder b);

        public override string ToString()
        {
            return Name;
        }

        protected Shader mShader;

        static protected string GetTextureFilterName(TextureParamter.Filter f)
        {
            switch (f)
            {
                case TextureParamter.Filter.Linear:
                    return "Linear";
                case TextureParamter.Filter.Point:
                    return "Point";
                case TextureParamter.Filter.Anisotropy:
                    return "Anisotropy";
                default:
                    return "Point";
            }
        }

        static protected string GetTextureAddressMode(TextureParamter.AddressMode m)
        {
            switch (m)
            {
                case TextureParamter.AddressMode.Clamp:
                    return "Clamp";
                case TextureParamter.AddressMode.Wrap:
                    return "Wrap";
                default:
                    return "Wrap";
            }
        }

        static protected void AppendFeatureCode(IFusion f, StringBuilder b)
        {
            b.AppendLine("//--------");
            b.AppendLine("// " + f.Name);
            b.AppendLine("{");
            f.Code(b, "");
            b.AppendLine("}");
        }

    }
}
